package com.wongsir.tiny_ioc.step1;

import org.junit.Test;

import com.wongsir.step1.tiny_ioc.BeanDefinition;
import com.wongsir.step1.tiny_ioc.BeanFactory;

/**
 * step1：BeanFactory test:
 * @author hjd
 * @date 2018年9月12日
 */
public class BeanFactoryTest1 {
	
	@Test
	public void test() {
		//1、初始化BeanFactory
		BeanFactory beanFactory = new BeanFactory();
		
		//2、注入bean
		BeanDefinition beanDefinition = new BeanDefinition(new HelloWorldService());
		beanFactory.registerBeanDefinition("helloworldService", beanDefinition);
		
		//3、获取bean
		HelloWorldService helloworldService = (HelloWorldService) beanFactory.getBean("helloworldService");
		helloworldService.helloworld();
		
	}
}
